package com.cys.dm.rest.service.es;

import com.cys.dm.vo.dmes.DmItemRowsEs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DmItemEsService {
    @Autowired
    private ElasticsearchRestTemplate elasticsearchTemplate;

    /**
     * 创建索引和创建字段映射
     */
    public void create_index() {
        elasticsearchTemplate.createIndex(DmItemRowsEs.class);
        elasticsearchTemplate.putMapping(DmItemRowsEs.class);
    }

    /**
     * 删除索引
     */
    public void delete_index() {
        //Clazz String
        elasticsearchTemplate.deleteIndex(DmItemRowsEs.class);
    }
}
